package com.usian.comment.controller.v1

import com.usian.apis.comment.CommentControllerApi
import com.usian.comment.service.CommentService
import com.usian.model.comment.dtos.CommentDto
import com.usian.model.comment.dtos.CommentLikeDto
import com.usian.model.comment.dtos.CommentSaveDto
import com.usian.model.common.dtos.ResponseResult
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/api/v1/comment")
class CommentController : CommentControllerApi {


    @Autowired
    lateinit var commentService: CommentService

    @PostMapping("/like")
    override fun like(@RequestBody dto: CommentLikeDto): ResponseResult<*> = commentService.like(dto)


    @PostMapping("/save")
    override fun saveComment(@RequestBody dto: CommentSaveDto): ResponseResult<*> = commentService.saveComment(dto)
    @PostMapping("/load")
    override fun findByArticleId(@RequestBody dto: CommentDto): ResponseResult<*> = commentService.findByArticleId(dto)


}